<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
<script src="js/jquery-2.1.0.js"></script>
<script src="js/pintuer.js"></script>
<script src="js/util.js"></script>
</head>
<body>
<form  id="listform">
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 教师列表</strong>
        <a href="addxx.html" style="float:right; display:none;">添加教师</a></div>
    <div class="padding border-bottom">
      <ul class="search" style="padding-left:10px;">
        <li> <a class="button border-main icon-plus-square-o" href="addxx.html"> 添加教师</a> </li>
        <li>
        	年级
          <select   id="smygrade"  name="s_isvouch" class="input"   style="width:100px; line-height:17px;display:inline-block">
             <option value="">请选择</option>
            <option value="1">小学一年级</option>
            <option value="2">小学二年级</option>
                            
          </select>
         &nbsp;&nbsp;
                       课程
            <select  id="smycourse"  name="s_isvouch" class="input" style="width:100px; line-height:17px;display:inline-block">
          
          </select>
        </li>
        <li>
          <input id="iname"  type="text" placeholder="请输入教师名称" name="keywords" class="input" style="width:250px; line-height:17px;display:inline-block" />
          <a href="javascript:void(0)" class="button border-main icon-search" onclick="namesearch()" > 搜索</a></li>
      </ul>
    </div>
    <table id="teachertable" class="table table-hover text-center">
        <tr><th width="100" style="text-align:left; padding-left:20px;">序号</th><th>姓名</th> <th>年龄</th> <th>部门</th><th width="310">操作</th> </tr>
    <tbody id="tb">


    </tbody>
    </table>
     <tr>
    	<td colspan="8">
    		<div class="pagelist"> 
    			<a id='first_page'  href="#">首页</a> 
    			<a id='last_page'   href="#">上一页</a> 
    		    <a id='next_page'   href="#">下一页</a>
    		    <a id='end_page'    href="#">尾页</a>
    		    <a id='jump_page'   href="#">跳转</a>
    		    <input id="page_no" style="height: 20px;width:30px"/>
    		    <input id="total_page"style="height: 20px;width:50px"  value="1 页"/>
    		</div>
    	</td>
    </tr>
    
  </div>
</form>
<script type="text/javascript">
//jquery（十一二、个）轻量级框架注意一定要引入资源文件
//页面加载就执行的方法  ,json对象数组 与json字符串
$(function(){
    $.ajax({
        type: "post",
        url: baseUrl+"/user/query",
        dataType:"json",
        success: function (res) {
             //id选择器
             $("#tb").empty();
             var trs = '';
             $.each(res,function (i,v) {
                 trs = trs+'<tr><td width="100" style="text-align:left; padding-left:20px;">'+(i+1)+'</td><td>'+v.name+'</td> <td>'+v.age+'</td> <td>'+v.did+'</td><td width="310"><a href="javascript:edit('+v.id+')">修改</a>|<a href="javascript:del('+v.id+')">删除</a></td> </tr>';
             })
            //追加
            $("#tb").append(trs);
        }
    })
})

function del(a) {
    $.ajax({
        type: "post",
        url: baseUrl+"/user/del",
        data: {"id":a},
        success: function (res) {
            if(res == '1'){
                window.location.reload();
            }
        }
    })
}

function edit(a) {
    window.location.href="addxx.html?"+a;
}
</script>



</body>
</html>